#include <cstdio>
#include <algorithm>
using namespace std;

typedef struct room
{
    int atmostcanbuy;
    int total_price;
    double value;
} Room;

bool cmp(Room A, Room B)
{
    return A.value > B.value;
}

int main()
{
    Room warehouse[1001];
    int M, N;
    int i;
    double result = 0.0;
    while (scanf("%d%d", &M, &N), M != -1 || N != -1)
    {
        result = 0;
        for (i = 0; i < N; i++)
        {
            scanf("%d%d", &warehouse[i].atmostcanbuy, &warehouse[i].total_price);
            warehouse[i].value = warehouse[i].atmostcanbuy * 1.0 / warehouse[i].total_price;
        }
        sort(warehouse, warehouse + N, cmp);
        for (i = 0; i < N; i++)
        {
            if (M > warehouse[i].total_price)
            {
                result += warehouse[i].atmostcanbuy;
                M -= warehouse[i].total_price;
            }
            else
            {
                result += warehouse[i].value * M;
                break;
            }
        }
        printf("%.3lf\n", result);
    }
}